import Roles from '../static/Roles';
const hasAccess =
(userRole, pageRoles) => pageRoles.indexOf(userRole) !== -1;
export { hasAccess };
export const Admin = {
link: '/admin',
roles: [Roles.ADMIN],
deliveryContainers: {
link: '/admin/delivery-containers',
roles: [Roles.ADMIN],
},
department: {
link: '/admin/department',
roles: [Roles.ADMIN],
},
groupDiets: {
link: '/admin/group-diets',
roles: [Roles.ADMIN],
},
species: {
link: '/admin/species',
roles: [Roles.ADMIN],
},
user: {
link: '/admin/user',
roles: [Roles.ADMIN],
},
};
export const Diet = {
link: '/diet',
roles: [Roles.ADMIN, Roles.NUTRITIONIST, Roles.KITCHEN, Roles.SUPERVISOR],
edit: {
link: '/diet/edit',
roles: [Roles.ADMIN, Roles.NUTRITIONIST],
},
new: {
link: '/diet/new',
roles: [Roles.ADMIN, Roles.NUTRITIONIST],
},
};
export const Food = {
link: '/food',
roles: [Roles.ADMIN, Roles.NUTRITIONIST, Roles.KITCHEN, Roles.SUPERVISOR],
edit: {
link: '/food/edit',
roles: [Roles.ADMIN, Roles.NUTRITIONIST],
},
new: {
link: '/food/new',
roles: [Roles.ADMIN, Roles.NUTRITIONIST],
},
nicknames: {
link: '/food/nicknames',
roles: [Roles.ADMIN, Roles.KITCHEN, Roles.NUTRITIONIST, Roles.SUPERVISOR],
},
dataSrc: {
link: '/food/dataSrc',
roles: [Roles.ADMIN, Roles.NUTRITIONIST],
},
nutrDef: {
link: '/food/nutrDef',
roles: [Roles.ADMIN, Roles.NUTRITIONIST],
},
units: {
link: '/food/units',
roles: [Roles.ADMIN, Roles.NUTRITIONIST],
},
};
export const Home = {
link: '/',
roles: [Roles.ADMIN, Roles.NUTRITIONIST, Roles.KITCHEN, Roles.SUPERVISOR, Roles.KEEPER],
};
export const Profile = {
link: '/profile',
roles: [Roles.ADMIN, Roles.NUTRITIONIST, Roles.KITCHEN, Roles.SUPERVISOR, Roles.KEEPER],
};
export const Kitchen = {
link: '/kitchen',
roles: [Roles.ADMIN, Roles.NUTRITIONIST, Roles.KITCHEN, Roles.SUPERVISOR],
prep: {
link: '/kitchen/prep',
roles: [Roles.ADMIN, Roles.NUTRITIONIST, Roles.KITCHEN, Roles.SUPERVISOR],
},
};